var XMLHttpRequestObject = false; 
var XMLHttpRequestObject2 = false; 

// Test the different navigators

function createXMLHttpRequest() 
{
   try { return new XMLHttpRequest(); } catch(e) {} 
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} //IE<7
   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}  IE>=7 
   alert("Sorry, you're not running a supported browser - XMLHttpRequest not supported");
  return false;
}

	XMLHttpRequestObject=new createXMLHttpRequest();
	XMLHttpRequestObject2=new createXMLHttpRequest();
/**************************************/
function getData(dataSource, divID) {	
	if(XMLHttpRequestObject) 
	{
		var obj = document.getElementById(divID);
		XMLHttpRequestObject.open("GET", dataSource, false);
		XMLHttpRequestObject.onreadystatechange = function() 
		{
			if (XMLHttpRequestObject.readyState == 4 && 
				(XMLHttpRequestObject.status == 200 || XMLHttpRequestObject.status == 0) )
			{
				$("#"+divID).fadeOut(300, function(){
					obj.innerHTML = XMLHttpRequestObject.responseText; 
					delete XMLHttpRequestObject;
					$("#"+divID).fadeIn(300);
				})				
			} 
		}	
		XMLHttpRequestObject.send(false); 
	}
	return false;
}  

/*function refresh()
{
$('#flux_rf').load('ajax/publish.php').fadeIn("slow");
}, 500);*/

function validupdateprofil() {
	window.document.forms['updateprofil'].updatetodb.value= 'update';
}

function checkPasswords() {
  var password1 = document.getElementById('password1');
  var password2 = document.getElementById('password2');
  if (password1.value != password2.value) {
    password2.setCustomValidity('Les mots de passe ne sont pas identiques');
  } else {
    password2.setCustomValidity('');
  }
}

function clearmsg() {
	localStorage.removeItem('result');
	clearTimeout(msg);
	location.href='accueil.php'
}
